package com.dinzeer.foxextra.data;

import com.dinzeer.foxextra.Foxextra;
import com.dinzeer.foxextra.regsiter.FEXItemTab;
import com.dinzeer.foxextra.regsiter.FEXSpecialEffectsRegistry;
import com.dinzeer.foxextra.regsiter.FEXslashArtRegsitry;
import mods.flammpfeil.slashblade.item.SwordType;
import mods.flammpfeil.slashblade.registry.slashblade.EnchantmentDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.PropertiesDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.RenderDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.SlashBladeDefinition;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.List;

public class FEXSlashBladeButilnRegsitry {


    //ex白狐
    public static final ResourceKey<SlashBladeDefinition> foxex_white=register("foxex_white");
    //ex黑狐
    public static final ResourceKey<SlashBladeDefinition> foxex_black=register("foxex_black");
    //exex灵刃狐月刀
    public static final ResourceKey<SlashBladeDefinition> foxexfinal=register("foxexfinal");








    public static void registerAll(BootstapContext<SlashBladeDefinition> bootstrap) {
        bootstrap.register(
                foxex_white, new SlashBladeDefinition(Foxextra.prefix("foxex_white"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Foxextra.prefix("model/foxex/texture.png"))
                                .modelName(Foxextra.prefix("model/foxex/model.obj"))
                                .effectColor(16187647)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .addSpecialEffect(FEXSpecialEffectsRegistry.FoxBlessing.getId())
                                .slashArtsType(FEXslashArtRegsitry.VoidSlashPlus.getId())
                                .baseAttackModifier(13)
                                .maxDamage(2000)
                                .build(),
                        List.of(new EnchantmentDefinition(getEnchantmentID(Enchantments.SMITE), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.BANE_OF_ARTHROPODS), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 7),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.FIRE_ASPECT), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.POWER_ARROWS), 3)
                        ),
                        FEXItemTab.Slashblade.getId()
                ));
        bootstrap.register(
                foxex_black, new SlashBladeDefinition(Foxextra.prefix("foxex_black"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Foxextra.prefix("model/foxex/texture2.png"))
                                .modelName(Foxextra.prefix("model/foxex/model.obj"))
                                .effectColor(2633861)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .addSpecialEffect(FEXSpecialEffectsRegistry.FoxBlessing.getId())
                                .slashArtsType(FEXslashArtRegsitry.Thrust.getId())
                                .baseAttackModifier(15)
                                .maxDamage(2000)
                                .build(),
                        List.of(new EnchantmentDefinition(getEnchantmentID(Enchantments.SMITE), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.BANE_OF_ARTHROPODS), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.MOB_LOOTING), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.FIRE_ASPECT), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.POWER_ARROWS), 3)
                        ),
                        FEXItemTab.Slashblade.getId()
                ));
        bootstrap.register(
                foxexfinal, new SlashBladeDefinition(Foxextra.prefix("foxexfinal"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Foxextra.prefix("model/foxex/texture3.png"))
                                .effectColor(16187647)
                                .modelName(Foxextra.prefix("model/foxex/model2.obj"))
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(FEXslashArtRegsitry.SAKURAENDEX.getId())
                                .addSpecialEffect(FEXSpecialEffectsRegistry.SummonSword.getId())
                                .addSpecialEffect(FEXSpecialEffectsRegistry.FoxBlessing.getId())
                                .baseAttackModifier(25)
                                .maxDamage(2000)
                                .build(),
                        List.of(new EnchantmentDefinition(getEnchantmentID(Enchantments.SMITE), 10),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.BANE_OF_ARTHROPODS), 10),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 10),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.FIRE_ASPECT), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.UNBREAKING), 3),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.POWER_ARROWS), 5)
                        ),
                        FEXItemTab.Slashblade.getId()
                )

        );
    }


    private static ResourceKey<SlashBladeDefinition> register(String id) {
        return ResourceKey.create(SlashBladeDefinition.REGISTRY_KEY, Foxextra.prefix(id));
    }
    static ResourceLocation getEnchantmentID(Enchantment enchantment) {
        return ForgeRegistries.ENCHANTMENTS.getKey(enchantment);
    }
}
